package dao.impl;

import dao.CustomerDao;
import dao.OrderDao;

/**
 * Created by yuanj on 2018/4/17.
 */
public class CustomerDaoImpl implements CustomerDao {

  private OrderDao orderDao;

  CustomerDaoImpl(OrderDao orderDao) {
    this.orderDao = orderDao;
  }

  public void setOrderDao(OrderDao orderDao) {
    this.orderDao = orderDao;
  }

  public OrderDao getOrderDao() {
    return orderDao;
  }

  public void print() {
    if (this.orderDao == null) {
      System.out.println("orderDao inject failed");
    }
    if (this.orderDao instanceof OrderDaoImpl) {
      OrderDaoImpl impl = (OrderDaoImpl) orderDao;
      System.out.println(impl.getType());
    } else {
      this.orderDao.getOrder();
    }
  }
}
